/*
 * @Description:
 * @Author: meihangbo
 * @Date: 2021-03-21 11:40:06
 * @LastEditTime: 2021-03-26 17:13:15
 * @LastEditors: meihangbo
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
// 导入路由组件 懒加载
const Login = () => import('../views/login/Login.vue')
const Home = () => import('../views/home/Home.vue')
const Welcome = () => import('../views/home/Welcome.vue')
const BookList = () => import('../views/bookInfoManager/BookList.vue')
const ShareBookList = () => import('../views/bookInfoManager/ShareBookList.vue')
const Announce = () => import('../views/announce/OunceList.vue')
const User = () => import('../views/user/userList.vue')
const BookReview = () => import('../views/bookReview/BookReview.vue')
const LeaveManager = () => import('../views/leaveManager/LeaveList.vue')
const DeclareInfo = () => import('../views/announce/declareInfo.vue')
const BookCate = () => import('../views/bookCate/CateList.vue')

// 安装路由
Vue.use(VueRouter)
// 配置路由路径
const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    component: Login
  },
  {
    // 访问 home 重定向到 welcome 页面
    path: '/home',
    component: Home,
    redirect: '/welcome',
    children: [
      {
        path: '/welcome',
        component: Welcome
      },
      {
        path: '/booklist',
        component: BookList
      },
      {
        path: '/sharebooklist',
        component: ShareBookList
      },
      {
        path: '/ouncelist',
        component: Announce
      },
      {
        path: '/userlist',
        component: User
      },
      {
        path: '/bookreview',
        component: BookReview
      },
      {
        path: '/leavemanager',
        component: LeaveManager
      },
      {
        path: '/declareinfo',
        component: DeclareInfo
      },
      {
        path: '/bookcatelist',
        component: BookCate
      }
    ]
  }
]
// 创建路由对象
const router = new VueRouter({
  routes,
  mode: 'history'
})
// 导出路由并挂在路由
export default router
